<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>咨询历史</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

    <!--<link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">-->

    <!-- 固定的css 和 common.js 的引用    -->
    <link rel="stylesheet" href="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/css/sm.min.css">
    <link rel="stylesheet" href="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/css/sm-extend.min.css">
    <script type="text/javascript" src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/common/js/common.js"></script>
    
<style type="text/css">
   /*设置取消li、a标签默认样式*/
   *{
    margin:0;
    padding:0;
   }
   li{
    list-style: none;
   }
   a{
     text-decoration: none;
   }
   /*头部样式*/
  /*.bar{background:#fff;padding:0 0.2rem 0 0;}*/
   /*主体部分样式*/
   .content{
    width: 100%;
    height: auto;
   }
   .content-nav{
    width: 100%;
    height: 3.0rem;
    background: #fff;
    padding-top:0.4rem;
    position:fixed;
    z-index: 200;
   }
   .nav-list{
    width: 95%;
    height: 2.0rem;
    background:#1C86EE;
    margin: 0 auto;
    border-radius:0.2rem;
    text-align: center;
   }
   .nav-list a{
     display: inline-block;
     width:1.4rem;
     float: left;
     margin-top:0.35rem;
     margin-left:35%;
   }
    .nav-list a img{
      display: block;
      width: 100%;
      height: 100%;
    }
   .nav-list span{
    color: #fff;
    font-size: 16px;
    float: left;
    margin-top:0.45rem;
    margin-left:2%;
   }
   .menu{
    width: 100%;
    height: 8.0rem;
    background:#fff;
    position: fixed;
    margin-top: 3.0rem;
    text-align: center;
    z-index: 200;
    box-shadow:0 0.2rem 0.4rem #ede;
    display: none;
   }
   .menu .menu-adult{
    padding: 0.4rem 1.3rem 0.42rem 1.3rem;
    border:1px solid #1C86EE;
    border-radius:0.3rem;
    float: left;
    margin-top:8%;
    margin-left:12%;
   }
   .menu .menu-children{
    padding: 0.4rem 1.3rem 0.42rem 1.3rem;
    border:1px solid #1C86EE;
    border-radius:0.3rem;
    float:right;
    margin-top:8%;
    margin-right:12%;
   }
   .menu .menu-adult a,.menu .menu-children a{
    display: inline-block;
    width: 1.5rem;
    float: left;
   }
   .menu .menu-adult span,.menu .menu-children span{
    font-size:16px;
    color: #1C86EE;
    display: inline-block;
    float: left;
    margin-left:0.5rem;
    margin-top:0.16rem;
   }
   .menu .menu-adult a img,.menu .menu-children a img{
    display: block;
    width: 100%;
   }
   .menu .menu-close{
    display: block;
    position: absolute;
    bottom:1%;
    left: 43%;
    padding:0.3rem 0.3rem;
  }
   .menu .menu-close img{
    display: block;
    width: 100%;
   }
   .content-main{
    width: 100%;
    height: auto;
    margin-top: 3.5rem;   
   }
   .card-img{
   	 display: inline-block;
   	 width: 2.0rem;
   	 height: 2.0rem;
   }
   .card-img img{
   	 display: block;
   	 width: 100%;
   	 height: 100%;
   }

  /*遮罩层效果*/
  #shade{
  width:100%;
  background:rgba(0,0,0,0.3);
  z-index: 100;
  position: absolute;
  bottom: 0;
  display: none;
}
</style>


</head>
<body>
<div class="page-group">
    <div class="page page-current">
  <!--     <header class="bar bar-nav" onclick="bodyclick()">
      	   <a class="pull-left"><img src="../../img/back-a.png"></a>
           <h1 class="title">咨询列表</h1>
      </header> -->
	    <!-- 主体内容 -->

	    <div class="content">
          <div class="content-nav" onclick="navclick()">
              <div class="nav-list">
                    <a href="javascript:;"><img src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/img/WechatIMG61.png"></a>
                    <span>和缓医生</span>
              </div>
          </div>
          <div class="menu">
              <div class="menu-adult">          
                 <a href="javascript:;"><img src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/img/WechatIMG58.png"></a>
                 <span>成人</span>
              </div>
              <div class="menu-children">
                <a href="javascript:;"><img src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/img/WechatIMG59.png"></a>
                <span>儿童</span>
              </div>
              <a class="menu-close" href="javascript:;" onclick="closeclick()"><img src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/img/WechatIMG60.png"></a>
          </div>
          <div class="content-main">
            <!-- <div class="card">
                      <div class="card-header">
                               <a href="javascript:;" class="card-img"><img src="../../img/l.png"></a>
                               <span>和缓医生_耿金平</span>
                               <span>医生视频咨询总结</span>
                      </div>
                      <div class="card-content">
                        <div class="card-content-inner">
                          <p>就诊人 丁先生</p>
                          <p>咨询时间 2018-6-5</p>
                        </div>
                      </div>
                      <div class="card-footer">
                        <p>详情</p>
                      </div>
                 </div> -->
          </div>
          <!-- 加载提示符 -->
          <div class="infinite-scroll-preloader">
              <div class="preloader"></div>
          </div>
	    </div>
      <!--遮罩效果 -->
      <div id="shade" onclick="bodyclick()">
      
      </div>
    </div>
</div>


<!-- 固定的js引用，所有的jQuery 要用 $$ 表示 -->
<script type="text/javascript" src="https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/js/jquery-1.11.1.min.js"></script>
<!-- 这一行代码是为了 避免js冲突 -->
<script type="text/javascript">var $$ =jQuery.noConflict();</script>
<script type='text/javascript' src='https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/CommonTraderUnionFile/raw/master/js/sm-extend.min.js' charset='utf-8'></script>


<script type="text/javascript">
// 加载flag
      var loading = false;
      // 最多可加载的条目
      var maxItems = 100;
      var offset = 0
      var limit = 12
      var lastlength = 12;
      var datalist = new Array();;

      // 注册'infinite'事件处理函数
      $(document).on('infinite', '.infinite-scroll-bottom',function() {

          // 如果正在加载，则退出
          if (loading) return;

          // 设置flag
          loading = true;

          // 模拟1s的加载过程
          setTimeout(function() {
              // 重置加载flag
              loading = false;
              console.log('================'+lastlength + '====' + limit);


              if (lastlength < limit) {
                  // 加载完毕，则注销无限加载事件，以防不必要的加载
                  $.detachInfiniteScroll($('.infinite-scroll'));
                  // 删除加载提示符
                  $('.infinite-scroll-preloader').remove();
                  return;
              }
               offset = datalist.length;
               getData();
              // 添加新条目
              // addItems(itemsPerLoad, lastIndex);
              // 更新最后加载的序号
              //容器发生改变,如果是js滚动，需要刷新滚动
              $.refreshScroller();
          }, 1000);
      });
 
  // 点击按钮显示的页面			
   function navclick(){
     // 点击出现遮罩效果
     var docheight = $$(document.body).height();
     $$('#shade').show();
     $$("#shade").css({ "height": docheight });

     if ($$('.menu').is(':hidden')){
         $$('.menu').show();
     }else{
         $$('.menu').hide();
         $$('#shade').hide();
     }

  }

  // 点击关闭按钮隐藏弹出页面
  function closeclick(){
    $$('.menu').hide();
    $$('#shade').hide();
  }
  
   // 点击隐藏按钮
  function bodyclick(){
    $$('.menu').hide();
    $$('#shade').hide();
  }

  // 遍历数据 页面内容    
  function getData(){
    var param = {}
    //http://47.94.232.49
    var url = '/apis/books?offset='+offset+'&limit='+limit;

    net_request('get',url,param,successCallBack,errorCallBack);
  }

   //成功函数回调 页面
	function successCallBack(data){

	  // <li class="item-content" id="imli"><div class="item-inner" id="it_iner"><div class="item-title"><img  src="' + item.img + '"><span>' + item.name + '</span></div></div></li>
	  if (isNotNull(data)) {
	    var databody = data.data;
	    // console.log(databody);
	    var html = '';
	    if (offset == 0) {
	      datalist = new Array();
	    }
	    if (isNotNull(databody)) {
	        
	       var html = '';
	       lastlength = databody.length;
	       for (var i = 0; i < databody.length; i++) {
	          var item = databody[i];
	          datalist.push(item);
	      }

	      for (var i = 0; i < datalist.length; i++) {
	            var item = datalist[i];
	            if (isNotNull(item)) {
	            html +=`<div class="card"  onclick="itemClick()">
						    <div class="card-header">
			                   <a href="javascript:;" class="card-img"><img src="${item.img}"></a>
			                   <span>${item.category}</span>
			                   <span>${item.grade}</span>
						    </div>
						    <div class="card-content">
						      <div class="card-content-inner">
						      	<p>就诊人  ${item.name}</p>
						      	<p>咨询时间  ${item.updated_at}</p>
						      </div>
						    </div>
						    <div class="card-footer">
						    	<p>${item.desc}</p>
						    </div>
		               </div>`;                   	                   
	            }           
	      }
	    }
	             $('.content-main').html(html);
	  }
	}

	//失败函数回调
	function errorCallBack(data){
	  console.log(data);
	}
 
    function getParams(data){
	   // data需要转成json调用 ，函数urlParamParseJson();
	     /*var jodata = JSON.parse(data); 
	     if(isNotNull(jodata)){//
	        
	     }*/

	}

  function itemClick(){
    native_goto("local/doctor/advisory_details");
  }

   	// 初始化区域
  	$$(function () {
        getData();
      	$.init();
   	});

    
</script>
</body>
</html>